
{template "common/header"}

    <div >
      <div class="tabbable" id="tabs-561797">
        <ul class="nav nav-tabs">
          <li {if $op == 'list'}class="active"{/if}>
             <a href="{php echo $this->createWebUrl('module',array('op'=>'list'))}" >模块列表</a>
          </li>
          <li {if $op == 'post'}class="active"{/if}>
             <a href="{php echo $this->createWebUrl('module',array('op'=>'post'))}" >添加模块</a>
          </li>
          {if $op == 'lessonlist'}
          <li {if $op == 'lessonlist'}class="active"{/if}>
             <a href="{php echo $this->createWebUrl('module',array('op'=>'addlesson'))}" >模块课程</a>
          </li>
          {/if}
        </ul>
        <div class="tab-content">
          {if $op == 'list'}
          <table class="table table-bordered table-hover">
            <thead>
              <tr style="background-color: #D9EDF7">
                <th>模块名称</th>
                <th>模块ID</th>
                <th>排序</th>
                <th>课程数量</th>
                <th>模块状态</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
              {loop $modulelist $row}
              <tr>
                <td>{$row['name']}</td>
                <td>{$row['id']}</td>
                <td>{$row['order']}</td>
                <td>{$row['num']}</td>
                <td>{if $row['status'] == 0}不显示{elseif $row['status'] == 1}显示{/if}</td>
                <td>
                  <div class="btn-group">
                     <button class="btn btn-default" disabled>操作</button> 
                     <button data-toggle="dropdown" class="btn btn-default dropdown-toggle"><span class="caret"></span></button>
                    <ul class="dropdown-menu">
                      <li>
                         <a href="{php echo $this->createWebUrl('module',array('op'=>'post','id'=>$row['id']))}">编辑</a>
                      </li>
                      <li >
                         <a href="{php echo $this->createWebUrl('module',array('op'=>'delete','id'=>$row['id']))}">删除</a>
                      </li>
                      <li >
                        <a href="{php echo $this->createWebUrl('module',array('op'=>'lessonlist','id'=>$row['id']))}">查看课程</a>
                      </li>
                    </ul>
                  </div>
                </td>
              </tr>
              {/loop}
            </tbody>
          </table>
          {elseif $op == 'post'}
          <div class="list-group">
            <p href="#" class="list-group-item active" style="background-color: #D9EDF7;border:1px solid #D9EDF7;color:#31708F">推荐模块为首页显示块去，建议模块数量不超过5个，谨慎设置</p>
            <div active="list-group-item" style="border:1px solid #cecece">
              <form action="" method="post" class="form-horizontal" >
                <div class="form-group" style="margin-top:25px">
                  <label  class="col-sm-2 control-label">模块名称</label>
                  <div class="col-sm-10">
                    <input type="text" name="name" value="{$info['name']}"  placeholder=""  class="form-control" style="width:98%"/>
                  </div>
                </div>
                <div class="form-group" style="margin-top:25px">
                  <label  class="col-sm-2 control-label">模块排序</label>
                  <div class="col-sm-10">
                    <input type="number" name="order" value="{$info['order']}"  placeholder=""  class="form-control" style="width:98%"/>
                    <span class="help-block">请填写0到100的数字，数字越大排序越靠前</span>
                  </div>
                </div>
                <div class="form-group" style="margin-top:25px">
                  <label  class="col-sm-2 control-label">显示课程数</label>
                  <div class="col-sm-10">
                    <input type="number" name="num" value="{$info['num']}"  placeholder=""  class="form-control" style="width:98%"/>
                    <span class="help-block">建议为偶数，最佳选择为4</span>
                  </div>
                </div>
                <div class="form-group" style="margin-top:25px">
                  <label  class="col-sm-2 control-label">模块图标</label>
                  <div class="col-sm-10" style="width:82%">
                    {php echo tpl_form_field_image('image',$info['image'])}
                    <span class="help-block">建议图片为20*20的小图标</span>
                  </div>
                </div>
                <div class="form-group ">
                    <label class="col-sm-2 control-label">模块状态</label>
                    <div class=" col-sm-10" style="padding-left:25px">
                      <label class="radio-inline">
                        <input type="radio" name="status" value="0" title="不显示" {if $info['status'] == '0'}checked{/if} > 不显示
                      </label>
                      <label class="checkbox-inline">
                        <input type="radio" name="status" value="1" title="显示" {if $info['status'] == '1'}checked{/if} > 显示
                      </label>
                      <span class="help-block">设置模块是否在PC端显示</span>
                    </div>
                </div>
                <input type="hidden" name="token" value="{$_W['token']}">
                <div style="float: right;margin:10px">
                  <input type="submit" name="submit" value="提交" class="btn btn-info" >
                </div>
                <div style="clear: both;"></div>
              </form>
            </div>
          </div>
          {elseif $op == 'lessonlist'}
          <table class="table table-bordered table-hover">
            <thead>
            <tr style="background-color: #D9EDF7">
              <th>课程名称</th>
              <th>课程ID</th>
              <th>章节数量</th>
              <th>课程状态</th>
              <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {loop $lesson_list $row}
            <tr>
              <td>{$row['title']}</td>
              <td>{$row['id']}</td>
              <td>{$row['snum']}</td>
              <td>{if $row['status'] == 0}不显示{elseif $row['status'] == 1}显示{/if}</td>
              <td>
                <a href="{php echo $this->createWebUrl('module',array('op'=>'removelesson','id'=>$row['id'],'mid'=>$mid))}" class="btn btn-danger">移除模块</a>
              </td>
            </tr>
            {/loop}
            </tbody>
          </table>
          {/if}
        </div>
      </div>
    </div>


{template "common/footer"}